/**
 * No reference counting so nodes should only exist in only one linked list.
 * Data pointer should only point into the heap. List will not perform copy of
 * data.
 */

#ifndef CLIST_H
#define CLIST_H

typedef struct cnode
{
  struct cnode* next;
  void* data;
} cnode_t;

typedef struct clist
{
  cnode_t* front;
  cnode_t* end;
  int size;
} clist_t;

clist_t* new_clist();

void clist_push_back(clist_t* list, void* data);

void clist_push_front(clist_t* list, void* data);

void* clist_pop_back(clist_t* list);

void* clist_pop_front(clist_t* list);

void* clist_remove(clist_t* list, int index);

void clist_reverse(clist_t* list);

int clist_size(clist_t* list);

/*frees the clist_t and all the cnode_t elements. Will not free data ptrs*/
void clist_free(clist_t* list);

#endif
